<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <title>会员管理</title>

    <link th:include="common::com_css">

</head>

<body class="sticky-header">
<section>
    <div th:replace="common :: #com_leftmenu"></div>
    <div class="main-content">
        <div th:replace="common :: #com_headermenu"></div>
        <div class="wrapper">
            <div class="col-sm-12">
                <div class="adv-table editable-table">
                    <section id="no-more-tables">
                        <div th:replace="common :: #com_alert"></div>
                        <table th:if="${memberList}!=null" class="table table-bordered table-striped table-condensed cf" id="editable-sample">
                            <thead class="cf">
                            <tr>
                                <th style="text-align: center">账号</th>
                                <th style="text-align: center">昵称</th>
                                <th style="text-align: center">性别</th>
                                <th style="text-align: center">生日</th>
                                <th style="text-align: center">手机号</th>
                                <th style="text-align: center">邮箱</th>
                                <th style="text-align: center">状态</th>
                                <th style="text-align: center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr th:each="m:${memberList}" style="text-align: center">
                                    <td data-title="账号">
                                        <span th:text="${m.account}"></span>
                                    </td>
                                    <td data-title="昵称" style="text-align: center">
                                        <span th:text="${m.nickname}"></span>
                                    </td>
                                    <td data-title="性别" th:switch="${m.gender}">
                                        <span th:case="0" class="label label-default">不详</span>
                                        <span th:case="1" class="label label-success">男</span>
                                        <span th:case="2" class="label label-info">女</span>
                                    </td>
                                    <td data-title="生日">
                                        <span th:text="${m.birthday}"></span>
                                    </td>
                                    <td data-title="手机号">
                                        <span th:text="${m.phoneNum}"></span>
                                    </td>
                                    <td data-title="邮箱">
                                        <span th:text="${m.email}"></span>
                                    </td>
                                    <td data-title="状态" th:switch="${m.state}">
                                        <span class="label label-danger" th:case="0">已封禁</span>
                                        <span class="label label-success" th:case="1">正常</span>
                                    </td>
                                    <td data-title="操作" style="text-align: center"th:switch="${m.state}">
                                        <input type="hidden" id="state" th:value="${m.state}">
                                        <a th:case="0" class="btn btn-sm btn-success d1" put_url="/updateMemberState" th:put_id="${m.id}">解封</a>
                                        <a th:case="1" class="btn btn-sm btn-danger d1" put_url="/updateMemberState" th:put_id="${m.id}">封禁</a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <form id="delEmpRorm" method="post">
                            <input type="hidden" id="d_id" name="id">
                        </form>
                    </section>
                </div>
            </div>

        </div>
        <footer class="sticky-footer">
            2021 &copy; <a href="https://github.com/ZhangHeng0805" target="_blank">星曦向荣</a>
        </footer>
    </div>
</section>

<div th:include="common::#com_js"></div>
<script>
    jQuery(document).ready(function() {
        EditableTable.init();
    });
    $(".d1").click(function () {
        var sta=$("#state").val();
        if (sta==0){
            var d=window.confirm("确定解封此用户？");
        } else {
            var d=window.confirm("确定封禁此用户？");
        }

        if(d) {
            $("#d_id").attr("value", $(this).attr("put_id"));
            $("#delEmpRorm").attr("action", $(this).attr("put_url")).submit();
            return false;
        }
    });
</script>
</body>
</html>